<?xml version="1.0" encoding="Shift_JIS" ?>
<!--
	lhadecompressor for java build file.
	
	@author nosue@users.sourceforge.net
-->
<project name="lhadecompressor" default="dist" basedir=".">
	<property name="name"				value="lha"/>
	<property name="src.encoding"		value="UTF-8"/>
	<property name="compile.debug"		value="false"/>
	<property name="compile.optimize"	value="true"/>
	<property name="compile.source"		value="1.2"/>
	<property name="compile.target"		value="1.2"/>
	
	<property name="src"				value="${basedir}/src"/>
	<property name="target"				value="${basedir}/target"/>
	<property name="build"				value="${target}/classes"/>
	<property name="dist"				value="${target}/dist"/>
	<property name="doc"				value="${target}/doc"/>
	<property name="javadoc"			value="${doc}/javadoc"/>
	<property name="tmp"				value="${basedir}/tmp"/>
	<property name="src.main"			value="${src}/main/java"/>
	<property name="src.test"			value="${src}/test/java"/>
	<property name="lib.main"			value="${src}/main/libraries"/>
	<property name="lib.test"			value="${src}/test/libraries"/>
	<property name="rsrc.main"			value="${src}/main/resources"/>
	<property name="rsrc.test"			value="${src}/test/resources"/>
	
	<path id="compile.main">
		<fileset dir="${lib.main}">
			<include name="**/*.jar"/>
		</fileset>
	</path>
	
	<path id="compile.test">
		<fileset dir="${lib.main}">
			<include name="**/*.jar"/>
		</fileset>
		<fileset dir="${lib.test}">
			<include name="**/*.jar"/>
		</fileset>
	</path>
	
	<target name="init"
		description="Initialize project.">
		<mkdir dir="${target}"/>
		<mkdir dir="${doc}"/>
		<mkdir dir="${tmp}"/>
	</target>
	
	<target name="clean"
		description="Clean project.">
		<delete dir="${build}"/>
		<delete dir="${dist}"/>
		<delete dir="${javadoc}"/>
	</target>
	
	<target name="compile.main"
		description="Compile project."
		depends="init">
		<delete dir="${build}"/>
		<mkdir dir="${build}"/>
		<javac
			srcdir="${src.main}"
			destdir="${build}"
			debug="${compile.debug}"
			optimize="${compile.optimize}"
			deprecation="${compile.deprecation}"
			encoding="${src.encoding}"
			source="${compile.source}"
			target="${compile.target}">
			<classpath refid="compile.main"/>
		</javac>
	</target>
	
	<target name="compile.test"
		description="Compile project."
		depends="compile.main">
		<javac
			srcdir="${src.test}"
			destdir="${build}"
			debug="${compile.debug}"
			optimize="${compile.optimize}"
			deprecation="${compile.deprecation}"
			encoding="${src.encoding}"
			source="${compile.source}"
			target="${compile.target}">
			<classpath refid="compile.test"/>
		</javac>
	</target>

	<target name="test"
		description="Test project."
		depends="compile.test">
		<junit printsummary="yes" haltonfailure="false">
			<classpath refid="compile.test"/>
			<classpath>
				<pathelement path="${build}"/>
			</classpath>
			<formatter type="plain"/>
			<test name="net.sourceforge.lhadecompressor.test.LhaTest"/>
		</junit>
	</target>
	
	<target name="dist"
		description="Make distribution files."
		depends="compile.main">
		<mkdir dir="${dist}"/>
		<tstamp>
			<format property="touch.time" pattern="yyyyMMdd-HHmmss"/>
		</tstamp>
		<jar destfile="${dist}/${name}-${touch.time}.jar" index="true">
			<fileset dir="${build}"/>
		</jar>
		<copy
			file="${dist}/${name}-${touch.time}.jar"
			tofile="${dist}/${name}.jar"
			overwrite="true"/>
	</target>

	<target name="javadoc"
		description="Make javadocs."
		depends="compile.main">
		<delete dir="${javadoc}"/>
		<mkdir dir="${javadoc}"/>
		<javadoc
			packagenames="*"
			sourcepath="${src}"
			destdir="${javadoc}"
			encoding="${src.encoding}"
			docencoding="${src.encoding}">
			<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
		</javadoc>
	</target>
	
</project>